package com.yidian.controller.order;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yidian.server.order.CategoryReportService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author whb
 * @create 2021-05-28 17:25
 * @desciption 测试SpringTask定时任务
 */
@Component
public class OrderTask {
    @Reference
    private CategoryReportService categoryReportService;

    //@Scheduled(cron = "* * * * * ?")
    public void outPreSecond(){
        System.out.println(new Date());
    }

    @Scheduled(cron = "0 0 1 * * ?")
    public void taskSaveCategoryTj(){
        System.out.println("商品类目统计数据保存..");
        categoryReportService.saveCategoryTj();
    }
}
